{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf340
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\margl1440\margr1440\vieww10800\viewh8400\viewkind0
\deftab720
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardeftab720\pardirnatural

\f0\fs24 \cf0 rails new Blogger\
\
rails g model User first_name:string last_name:string email_address:string\
rails g model Blog name:string description:text\
rails g model Owner user:references blog:references\
rails g model Post title:string content:text blog:references user:references\
rails g model Message author:string message:text post:references user:references\
\
rake db:migrate\
\
User.create(first_name: "User1", last_name: "Last1", email_address: "User1@gmail.com")\
User.create(first_name: "User2", last_name: "Last2", email_address: "User2@gmail.com")\
User.create(first_name: "User3", last_name: "Last3", email_address: "User3@gmail.com")\
User.create(first_name: "User4", last_name: "Last4", email_address: "User4@gmail.com")\
User.create(first_name: "User5", last_name: "Last5", email_address: "User5@gmail.com")\
\
Blog.create(name:"Blog1", description:"Blog1 Description: This is a standard description")\
Blog.create(name:"Blog2", description:"Blog2 Description: This is a standard description")\
Blog.create(name:"Blog3", description:"Blog3 Description: This is a standard description")\
Blog.create(name:"Blog4", description:"Blog4 Description: This is a standard description")\
Blog.create(name:"Blog5", description:"Blog5 Description: This is a standard description")\
\
User.first.blogs = [Blog.last]\
User.find(2).blogs = [Blog.find(2)]\
User.find(3).blogs = [Blog.find(2)]\
\
User.find(1).posts.create(title:"Post1", content:"Post1 Imaginary Post Content!")\
User.find(1).posts.create(title:"Post2", content:"Post2 Imaginary Post Content!")\
User.find(1).posts.create(title:"Post3", content:"Post3 Imaginary Post Content!")\
\
Blog.first.posts = [Post.first, Post.find(2)]\
Blog.last.posts = [Post.last]\
\
User.find(2).messages.create(author:"George Washington", message:"Long live the United State of America!")\
Post.first.messages = [Message.first]\
\
Message.where("post_id=1")\
Post.first.messages\
Blog.first.users}